package 工具类;

public class Utils {

    private Utils() {
    }//构造器私有

    public static String ToString(int[] arr){
        if(arr == null){
            return null;
        }
        String result = "[";
        for(int i=0;i<arr.length;i++){
            result += (i == arr.length-1? arr[i] : arr[i]+",");
        }
        result += "]";
        return result;
    }

    public static double getAerage(double[] arr){
        double sum = 0;
        double max = -1;
        double min = 999;
        for (int i = 0; i < arr.length; i++) {
            sum+=arr[i];
            if(arr[i]>max){
                max = arr[i];
            }
            if(arr[i]<min){
                min = arr[i];
            }
        }
        sum -= (min+max);
        return sum/(arr.length-2);
    }
}
